#include <irrlicht.h>

using namespace irr;
using namespace core;
using namespace video;

class Airplane;
class Bullet;
class KeyboardEventsReceiver;

class World
{
	ITexture* groundImage;

	Airplane* leftAirplane;
	Airplane* rightAirplane;
public:
	array<Bullet> bullets;
	u32 bulletLastId; //each bullet has a unique id

public:
	IrrlichtDevice* device;
	IVideoDriver* driver;


	u32 time; //current time in millisecond
	f32 deltaTime;

	World(IrrlichtDevice* _device);
	~World();

	recti GetWorldSize();

	void AddBullet(position2df pos, f32 angle);
	void RemoveBullet(u32 number);

	void ProcessKeyboardEvents(KeyboardEventsReceiver* receiver);

	void RestructSplines(); //Airplanes moved, bullet also moved, fires animate here

	void DrawWorld();

	//draw image with rotating and scaling
	void draw2DImage(irr::video::ITexture* texture, irr::core::rect<irr::s32> sourceRect, 
		irr::core::position2d<irr::s32> position, irr::core::position2d<irr::s32> rotationPoint, 
		irr::f32 rotation, irr::core::vector2df scale, bool useAlphaChannel, irr::video::SColor color);
};